import { useDispatch, useSelector } from "react-redux";
import { increment, decrement,addToNum } from "./store/modules/counterStore";

function App() {
  const { count } = useSelector(state => state.counter)
  const dispatch = useDispatch()
  return (
    <div>
      <h1>redux基础使用</h1>
      {count}
      <br/>
      <button onClick={() => dispatch(decrement())}>-</button>
      <br/>
      <button onClick={() => dispatch(increment())}>+</button>
      <br/>
      <button onClick={() => dispatch(addToNum(5))}>+5</button>
    </div>
  );
}

export default App;

